﻿using System;
using System.Collections.Generic;
using Manager;
using UnityEngine;

namespace Studio
{
	// Token: 0x020004AC RID: 1196
	public class ColorChange
	{
		// Token: 0x06001DF7 RID: 7671 RVA: 0x000BE190 File Offset: 0x000BC390
		public static void SetHSColor(List<GameObject> lstTarget, HSColorSet color, bool chgDif = true, bool chgSpe = true, HSColorSet color2 = null, bool chgDif2 = true, bool chgSpe2 = true)
		{
			if (lstTarget.Count == 0)
			{
				return;
			}
			Color white = Color.white;
			if (color2 != null)
			{
				white = new Color(color2.rgbSpecular.r, color2.rgbSpecular.g, color2.rgbSpecular.b, color2.specularSharpness);
			}
			for (int i = 0; i < lstTarget.Count; i++)
			{
				Renderer component = lstTarget[i].GetComponent<Renderer>();
				if (!(null == component))
				{
					Material material = component.material;
					if (chgDif)
					{
						material.SetColor(Singleton<Manager.Character>.Instance._Color, color.rgbaDiffuse);
					}
					if (chgSpe)
					{
						material.SetColor(Singleton<Manager.Character>.Instance._SpecColor, color.rgbSpecular);
						material.SetFloat(Singleton<Manager.Character>.Instance._Metallic, color.specularIntensity);
						material.SetFloat(Singleton<Manager.Character>.Instance._Smoothness, color.specularSharpness);
					}
					if (color2 != null)
					{
						if (chgDif2 && material.HasProperty(Singleton<Manager.Character>.Instance._Color_3))
						{
							material.SetColor(Singleton<Manager.Character>.Instance._Color_3, color2.rgbaDiffuse);
						}
						if (chgSpe2 && material.HasProperty(Singleton<Manager.Character>.Instance._SpecColor_3))
						{
							material.SetColor(Singleton<Manager.Character>.Instance._SpecColor_3, white);
						}
					}
				}
			}
		}

		// Token: 0x06001DF8 RID: 7672 RVA: 0x000BE30C File Offset: 0x000BC50C
		public static void SetHSColor(Material mat, HSColorSet color, bool chgDif = true, bool chgSpe = true, HSColorSet color2 = null, bool chgDif2 = true, bool chgSpe2 = true)
		{
			if (null == mat)
			{
				return;
			}
			if (chgDif)
			{
				mat.SetColor(Singleton<Manager.Character>.Instance._Color, color.rgbaDiffuse);
			}
			if (chgSpe)
			{
				mat.SetColor(Singleton<Manager.Character>.Instance._SpecColor, color.rgbSpecular);
				mat.SetFloat(Singleton<Manager.Character>.Instance._Metallic, color.specularIntensity);
				mat.SetFloat(Singleton<Manager.Character>.Instance._Smoothness, color.specularSharpness);
			}
			if (color2 != null)
			{
				Color color3 = new Color(color2.rgbSpecular.r, color2.rgbSpecular.g, color2.rgbSpecular.b, color2.specularSharpness);
				if (chgDif2 && mat.HasProperty(Singleton<Manager.Character>.Instance._Color_3))
				{
					mat.SetColor(Singleton<Manager.Character>.Instance._Color_3, color2.rgbaDiffuse);
				}
				if (chgSpe2 && mat.HasProperty(Singleton<Manager.Character>.Instance._SpecColor_3))
				{
					mat.SetColor(Singleton<Manager.Character>.Instance._SpecColor_3, color3);
				}
			}
		}

		// Token: 0x06001DF9 RID: 7673 RVA: 0x000BE42C File Offset: 0x000BC62C
		public static bool CheckChangeSubColor(List<GameObject> lstTarget)
		{
			if (lstTarget.Count == 0)
			{
				return false;
			}
			for (int i = 0; i < lstTarget.Count; i++)
			{
				Renderer component = lstTarget[i].GetComponent<Renderer>();
				if (!(null == component))
				{
					Material material = component.material;
					if (material.HasProperty(Singleton<Manager.Character>.Instance._Color_3))
					{
						return true;
					}
				}
			}
			return false;
		}

		// Token: 0x06001DFA RID: 7674 RVA: 0x000BE49C File Offset: 0x000BC69C
		public static bool CheckChangeSubColor(Material mat)
		{
			return !(null == mat) && mat.HasProperty(Singleton<Manager.Character>.Instance._Color_3);
		}
	}
}
